let printLog = require('../log4j-config');
let crypto = require('crypto');
const secret = 'c49983cc7536f7b60d8b7605cd2689c0';//supermapcd-ymq
module.exports = function (req, res) {
    let hash = crypto.createHash('md5');
    hash.update(req.body.passWord);
    let writeSession = hash.digest('hex') === secret;
    if (writeSession) {
        req.session.validate = 'validate';
        printLog.INFO(`Vaild Administrator at IP : ${req.host}`)
        res.status(200).send({ succeed: true });
    }
    else {
        printLog.ERROR(`InVaild Administrator at IP : ${req.host}`)
        res.status(401).send({ succeed: false });
    }
}